package com.pospi.pospihold.ui.my_ui;

import android.os.Bundle;
import android.widget.TextView;

import com.pospi.pospihold.App;
import com.pospi.pospihold.R;
import com.pospi.pospihold.ui.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

public class AccountInfoActivity extends BaseActivity {

    @Bind(R.id.tv_number)
    TextView tvNumber;
    @Bind(R.id.tv_name)
    TextView tvName;
    @Bind(R.id.tv_account)
    TextView tvAccount;
    @Bind(R.id.tv_shop)
    TextView tvShop;
    @Bind(R.id.tv_device)
    TextView tvDevice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentLayout(R.layout.activity_account_info);
        setTitle(getResources().getString(R.string.accountInfo));
        ButterKnife.bind(this);
        String value = getSharedPreferences("Token", MODE_PRIVATE).getString("value", "");
        String[] names = value.split("\\,");
        String deviceNo = names[2];//得到token的值
        tvNumber.setText(String.format("工号: %s", App.getCashierMsgDto().getNumber()));
        tvName.setText(String.format("姓名: %s", App.getCashierMsgDto().getName()));
        tvAccount.setText(String.format("当前帐号: %s", getSharedPreferences("Token", MODE_PRIVATE).getString("userName", "null")));
        tvShop.setText(String.format("工作店铺: %s", getSharedPreferences("StoreMessage", MODE_PRIVATE).getString("Name", "null")));
        tvDevice.setText(String.format("设备号： %s", deviceNo));
    }
}
